package net.hn.hnms.biz.indicator.entity;

import java.time.Instant;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author 智呈物联 nzw
 * @date 2022/8/24
 */
/**
 * 常量类
 *
 * @author Jiangmf
 */
public class Constant {

        /**
         * 联网
         */
        public static final String CONNECT = "connect";

        /**
         * 在线
         */
        public static final String ONLINE = "online";

        /**
         * 离线
         */
        public static final String OFFLINE = "offline";
        /**
         * 全部系统
         */
        public static final String ALL  = "all";
        /**
         * 井下人员
         */
        public static final String JXRY = "jxry";
        /**
         * 安全监控
         */
        public static final String AQJK = "aqjk";
        /**
         * 视频监控
         */
        public static final String SPJK = "spjk";

        /**
         * 水害防治
         */
        public static final String SHFZ = "shfz";

        /**
         * 冲击地压
         */
        public static final String CJDY = "cjdy";

        /**
         * 重大设备
         */
        public static final String ZDSB = "zdsb";

        /**
         * 全国Id
         */
        public static final String CHINA_ORG_CODE = "0";

        /**
         * 省ID长度
         */
        public static final int PROVINCE_CODE_LENGTH = 2;

        /**
         * 分局ID长度
         */
        public static final int SUPERVISOR_CODE_LENGTH = 12;

        /**
         * 矿ID长度
         */
        public static final int MINE_CODE_LENGTH = 12;

        /**
         * 最小允许的查询范围
         */
        public static final int MIN_QUERY_DAYS = 1;
        /**
         * 最大允许的查询范围
         */
        public static final int MAX_QUERY_DAYS = 31;

        /**
         * 在线联网时效性检查
         */
        public static final int VALID_INTERVAL_LINK     = 120;
        /**
         * 安全监控时效性检查
         */
        public static final int VALID_INTERVAL_SENSOR   = 120;
        /**
         * 人员定位时效性检查
         */
        public static final int VALID_INTERVAL_LOCATION = 120;
        /**
         * 视频监控时效性检查
         * spjk_rt_camerainfo表 每小时同步一次
         */
        public static final int VALID_INTERVAL_VIDEO    = 60 * 24;
        /**
         * well_time在14小时
         */
        public static final int WELL_TIME               = 840;

        /**
         * 人员名单
         */
        public static final String STAFF_NAME      = "staffName";
        /**
         * 部门名单
         */
        public static final String DEPARTMENT_NAME = "departmentName";
        /**
         * 工种
         */
        public static final String WORK_TYPE       = "workType";

        /**
         * ch4/co 超时4小时未处理
         */
        public static final int    ALARM_UNHANDLED          = 4;
        /**
         * ch4超限时长超过5分钟
         */
        public static final int    CH4_ALARM_OVER_TIME      = 5;
        /**
         * ch4检测值超限0.03
         */
        public static final String CH4_ALARM_OVER_THRESHOLD = "0.03";

        /**
         * c0超限时长超过20分钟
         */
        public static final int CO_ALARM_OVER_TIME = 20;

        /**
         * 联网中断超过5分钟
         */
        public static final int DISCONTINUE_OVER_TIME = 1440;

        /**
         * co检测值超限100ppm
         */
        public static final String CO_ALARM_OVER_THRESHOLD = "100";

        /**
         * 瓦斯
         */
        public static final String CH4         = "0001";
        /**
         * 一氧化碳
         */
        public static final String CO          = "0004";
        /**
         * 局扇
         */
        public static final String FAN         = "1001";
        /**
         * 二氧化碳
         */
        public static final String CO2         = "0013";
        /**
         * 氧气
         */
        public static final String O2          = "0012";
        /**
         * 风速
         */
        public static final String WIND_SPEED  = "0002";
        /**
         * 烟雾
         */
        public static final String SMOG        = "1008";
        /**
         * 粉尘
         */
        public static final String DUST        = "0014";
        /**
         * 温度
         */
        public static final String TEMPERATURE = "0003";
        /**
         * 湿度
         */
        public static final String HUMIDITY    = "0018";

        /**
         * 主排水
         */
        public static final String  DRAINAGE_SYSTEM_ID   = "3100";
        /**
         * 通风
         */
        public static final String  VENTILATE_SYSTEM_ID   = "3000";
        /**
         * ZDJ
         */
        public static final String ZDJ_SYSTEM_ID = "3500";
        /**
         * HNGJ
         */
        public static final String HNGJ_SYSTEM_ID = "3600";
        /**
         * 盘区排水
         */
        public static final String PANEL_SYSTEM_ID = "3800";
        /**
         * 大巷皮带
         */
        public static final String  BELT_SYSTEM_ID   = "JY20";
        /**
         * 大巷皮带
         */
        public static final String  DXPD_SYSTEM_ID   = "ZY00";
        /**
         * 掘进机器人ID
         */
        public static final String TUNNEL_ROBOT_ID = "robot";

        /**
         * 安全监控
         */
        public static final String SAFETY_SYSTEM_CODE = "X0001";
        /**
         * 人员定位
         */
        public static final String LOCATION_SYSTEM_CODE = "X0002";
        /**
         * 风门
         */
        public static final String GATE_SYSTEM_CODE = "X0003";
        /**
         * 风窗
         */
        public static final String WINDOW_SYSTEM_CODE = "X0004";
        /**
         * 测风装置
         */
        public static final String WIND_SYSTEM_CODE = "X0005";
        /**
         * 防灭火测点
         */
        public static final String FMH_SYSTEM_CODE = "fmh";
        /**
         * 水害
         */
        /**
         * 顶板
         */

        /**
         * 超限报警
         */
        public static final String ALARM_TYPE_OVER_LIMIT    = "001";
        /**
         * 断电报警
         */
        public static final String ALARM_TYPE_POWER_OFF     = "002";
        /**
         * 馈电异常报警
         */
        public static final String ALARM_TYPE_FEED_ABNORMAL = "003";
        /**
         * 标校报警
         */
        public static final String ALARM_TYPE_CALIBRATION   = "007";


        /**
         * 疑似标校报警
         */
        public static final String ALARM_TYPE_MAYBE_CALIBRATION = "a01";

        /**
         * 限制区域
         */
        public static final String AREA_DISALLOWED   = "areaDisallowed";
        /**
         * 区域超员
         */
        public static final String AREA_OVERCROWDING = "areaOvercrowding";
        /**
         * 人员超时
         */
        public static final String PERSON_OVERTIME   = "personOvertime";
        /**
         * 人员求救
         */
        public static final String PERSON_HELP       = "personHelp";

        /**
         * 监测报警传感器
         */
        public static final String[] MONITOR_SENSOR_TYPES = new String[] {
                CH4, CO, O2, CO2, FAN, DUST, WIND_SPEED, TEMPERATURE
        };

        /**
         * 矿重要传感器
         */
        public static final String[] MINE_IMPORTANT_SENSOR_TYPES = new String[] {
                CH4, CO, FAN
        };

        /**
         * 资源门户用户id - 用于获取token
         */
        public static final String CLIENT_ID     = "33ede3b0a2ee444bb109f8818b47a2e9";
        /**
         * 资源门户密码 - 用于获取token
         */
        public static final String CLIENT_SECRET = "017cfd8bce6f4a60ae2384bba67e96ab";
        /**
         * 资源门户token key
         */
        public static final String  RESOURCE_PORTAL_TOKEN = "resourcePortalToken";
        /**
         * 资源门户参数值
         */
        public static final String  FROM_VALUE            = "370000000001";
        /**
         * 资源门户参数值
         */
        public static final String  TO_VALUE              = "110000000001";
        /**
         * 资源门户参数值
         */
        public static final String MESSAGE_SEQUENCE       = "2019010714141200001";
        /**
         * 事故资源名称
         */
        public static final String ACCIDENT_RESOURCE_NAME = "ds_mjxt_mj_t_mj_sjzl_sg_accident_info";
        /**
         *  监察接口表名称
         */
        public static final String ENFORCE_RESOURCE_NAME = "ds_mjxt_mj_t_mj_sjzl_zf_jczf_case";
        /**
         * 监察隐患表名称
         */
        public static final String ENFORCE_HIDDEN_RESOURCE_NAME = "ds_mjxt_mj_t_mj_sjzl_zf_jczf_danger";
        /**
         * 事故资源门户最大返回数
         */
        public static final String MAX_RETURN_NUM         = "1000";
        /**
         * 事故级别 特大
         */
        public static final Integer ACCIDENT_MAJOR_LEVEL   = 40;
        /**
         * 事故级别 重大
         */
        public static final Integer ACCIDENT_SERIOUS_LEVEL = 30;
        /**
         * 事故级别 较大
         */
        public static final Integer ACCIDENT_LARGE_LEVEL   = 20;
        /**
         * 事故级别 一般
         */
        public static final Integer ACCIDENT_GENERAL_LEVEL = 10;

        /**
         * 强制接入矿井的假定接入时间
         */
        public static final Instant FAKE_UPLOAD_TIME = Instant.parse("2020-03-15T03:12:03Z");

        /**
         * alarm表对应回填字段
         */
        public static final String SENSOR_CALIBRATION = "传感器标校";
        public static final String BLASTING_OPERATIONS= "爆破作业";
        /**
         * alarm表analysis_statistics_type回填字段code
         */
        public static final String STATISTICS_TYPE= "a02";
        public static final String STATISTICS_TYPE_DATA= "a04";

        /**
         * 监察级别
         */
        public static final String ENFORCE_A_LEVEL = "A";
        public static final String ENFORCE_B_LEVEL = "B";
        public static final String ENFORCE_C_LEVEL = "C";
        public static final String ENFORCE_D_LEVEL = "D";
        public static final String ENFORCE_PARENT_LEVEL = "煤矿上级公司";
        /**
         * 监察隐患level
         */
        public static final String HIDDEN_TYPE_YES = "是";
        public static final String HIDDEN_TYPE_NO = "否";
        /**
         *人员定位超时告警
         */
        public static final String LOCATION_TIMEOUT_ALARM ="0" ;
        /**
         *人员定位超限告警
         */
        public static final String LOCATION_CROWD_ALARM ="1" ;
        /**
         *人员定位求救告警
         */
        public static final String LOCATION_HELP_ALARM ="2" ;

        /** 压风*******************************************/
        public static final String MINE_URL ="config:" ;

        /**
         * 解析重大设备，每次最多解析数据为2分钟内数据
         */
        public static final long STEP_MINUTE = 60;

        public static final String DEFAULT_START_TIME = "2022-01-19T00:00:00Z";
        public static final String DRAINAGE_NAME = "xbd_now_zybf_zps";
        public static final String COMPRESSOR_NAME = "dwd_zdsb_his_compressornews";
        public static final String COMPRESSOR_NAME1 = "xbd_now_yfj";
        public static final String VENTILATE_NAME = "xbd_now_zstf";
        public static final String BELT_NAME = "xbd_now_dxpd";
        public static final String COAL_NAME = "xbd_now_zml";
        public static final String ZDJ_NAME = "xbd_now_zdj";
        public static final String HNGJ_NAME = "xbd_now_hngj";
        public static final boolean DATA_OK =true ;

        /***矿区基本配置***/
        /**
         * 基本配置
         */
        public static final String MINE_BASE="mine_base";
        /**
         * 矿区名称
         */
        public static final String MINE_NAME="mine_base1";
        /**
         * 矿井状况
         */
        public static final String MINE_STATUS="mine_base2";
        /**
         * 开采类型
         */
        public static final String MINE_TYPE="mine_base3";
        /**
         * 设计生产能力
         */
        public static final String MINE_PRODUCTION="mine_base4";
        /**
         * 核定生产能力
         */
        public static final String MINE_VOUCH_PRODUCTION="mine_base5";
        /**
         * 许可证状态
         */
        public static final String MINE_LICENCE_STATUS="mine_base6";
        /**
         * 水文地质类型
         */
        public static final String MINE_HYDROLOGY="mine_base7";
        /**
         * 有无冲击地压
         */
        public static final String MINE_SHOCK="mine_base8";
        /**
         * 瓦斯等级
         */
        public static final String MINE_GAS_LEVEL="mine_base9";
        /**
         * 安全标准化等级
         */
        public static final String MINE_SAFE_LEVEL="mine_base10";
        /**
         * 矿图配置
         */
        public static final String MINE_MAP_URL="mine_base11";

        /**
         * 煤流系统编码
         */
        public static final String COAL_SYSTEM_ID = "ZY00";
        /**
         *
         */
        public static final String COMPRESSOR_SYSTEM_ID = "3400";

        public static final String MotorName ="变频";

        public static final String GAS = "gas";//瓦斯
        public static final String WATER = "water";//水害
        public static final String FIRE = "fire";//火灾
        public static final String ROOF = "roof";//顶板
        public static final String INDICATOR_DUST = "dust"; //粉尘
        /**
         * 火灾权重
         */
        public static final double FIRE_WEIGHT = 0.3;
        /**
         * 水害权重
         */
        public static final double WATER_WEIGHT = 0.30;
        /**
         * 粉尘权重
         */
        public static final double DUST_WEIGHT = 0.15;
        /**
         * 顶板权重
         */
        public static final double ABSCISS_WEIGHT = 0.15;
        /**
         * 瓦斯权重
         */
        public static final double GAS_WEIGHT = 0.1;

        /**
         * 发布预警人员定位
         */
        public static final String PUBLISH_STAFF_LOCATION = "1";
        /**
         * 发布预警应急广播
         */
        public static final String PUBLISH_BROADCAST = "2";
        /**
         * 发布预警单兵及钉钉
         */
        public static final String PUBLISH_DING = "3";

        /**
         * 工作面级别发布预警
         */
        public static final String PUBLISH_LEVEL_WORKFACE = "1";
        /**
         * 全矿级别发布预警
         */
        public static final String PUBLISH_LEVEL_MINE = "2";

        /**
         * 区域级别发布预警
         */
        public static final String PUBLISH_LEVEL_AREA = "3";

        /**
         * 应急广播单播
         */
        public static final Integer BROADCAST_SINGLE = 0;

        /**
         * 应急广播组播
         */
        public static final Integer BROADCAST_GROUP = 1;

        /**
         * 人员定位分站
         */
        public static final String KJTX_LOCATION_STATION = "1";
        /**
         * 人员定位射频卡
         */
        public static final String KJTX_LOCATION_STAFF = "3";
        /**
         * 钉钉发送消息级别所有人
         */
        public static final Integer DING_SEND_ALL = 0;
        /**
         * 钉钉发送消息级别一号矿
         */
        public static final Integer DING_SEND_MINE = 1;
        /**
         * 钉钉发送消息级别- 根据用户名列表发送
         */
        public static final Integer DING_SEND_USER = 3;


        /**
         * 红色预警
         */
        public static final Integer ALARM_RED_LEVEL = 1;
        /**
         * 橙色预警
         */
        public static final Integer ALARM_ORANGE_LEVEL = 2;
        /**
         * 黄色预警
         */
        public static final Integer ALARM_YELLOW_LEVEL = 3;
        /**
         * 蓝色预警
         */
        public static final Integer ALARM_BLUE_LEVEL = 4;

        /**
         * JSON_RPC 版本
         */
        public static final String JSONRPC = "2.0";

        /**
         * 盘区泵房
         */
        public static final String PQ_WATER_PUMP = "pq";

        /**
         * 中央泵房
         */
        public static final String ZY_WATER_PUMP = "zy";

        /**
         * RPC读取接口
         */
        public static final String PLCPROGRAM_READ = "PlcProgram.Read";
        /**
         * RPC写入接口
         */
        public static final String PLCPROGRAM_WRITE = "PlcProgram.Write";



        /***
         * 泵房 - 排水流量
         */
        public static final String ZYPQ_PUMPFLOW = ".PumpFlow";
        /**
         * 泵房 - 排水压力
         */
        public static final String ZYPQ_OUTLETPRESSURE = ".OutletPressure";
        /**
         * 泵房 - 定子温度
         */
        public static final String ZYPQ_STATORTEM = ".StatorTem";
        /**
         * 泵房 - 电机电流
         */
        public static final String ZYPQ_MOTORCURRENT = ".MotorCurrent";
        /**
         * 泵房 - 电机运行
         */
        public static final String ZYPQ_MOTORRUN = ".MotorRun";
        /**
         * 泵房启动
         */
        public static final String ZYPQ_LINKAGESTART = ".LinkageStart";
        /**
         * 泵房停止
         */
        public static final String ZYPQ_LINKAGESTOP = ".LinkageStop";

        /**
         * 泵房 - 是否加入联控
         */
        public static final String ZYPQ_INPUT = ".InPut";

        public static final String HNGJ_START = "hngj_start";
        public static final String HNGJ_STOP = "hngj_stop";

        public static final String ZD_START = "zd_start";
        public static final String ZD_STOP = "zd_stop";

        public static final String QSB_NODE_ID = "S7.HNGJ.DI_%d.HNGJ_ZJ%d_QSB_YX";
        public static final String QSB_NODE_NAME = "清水泵";
        public static final String DLGLJ_NODE_ID = "S7.HNGJ.DI_%d.HNGJ_ZJ%d_DLGLJ_YX";
        public static final String DLGLJ_NODE_NAME = "定量给料机";
        public static final String LJJ_NODE_ID = "S7.HNGJ.DI_%d.HNGJ_ZJ%d_LJB_YX";
        public static final String LJJ_NODE_NAME = "滤浆机";
        public static final String ZJJ_NODE_ID = "S7.HNGJ.DI_%d.HNGJ_ZJ%d_ZJB_YX";
        public static final String ZJJ_NODE_NAME = "制浆机";
        public static final String PDSSJ_NODE_ID = "S7.HNGJ.DI_%d.HNGJ_ZJ%d_PDSSJ_YX";
        public static final String PDSSJ_NODE_NAME = "皮带输送机";


        public static final String ZD_STATUS_YX = "S7.ZDXT%d.BS_ZDXT%d_ZJ_YX";
        public static final String ZD_CONCENTRATION = "S7.ZDXT%d.BS_ZDXT%d_DQ_ND";
        public static final String ZD_FLOW = "S7.ZDXT%d.BS_ZDXT%d_LL";
        public static final String ZD_N2PRESSURE = "S7.ZDXT%d.BS_ZDXT%d_DQG_YL";
        public static final String ZD_KPRESSURE = "S7.ZDXT%d.BS_ZDXT%d_KQG_YL";

        /**
         * 防灭火 - 是否允许控制
         */
        public static final boolean FIRE_CONTROL_DEBUG = false;

        public static final Map<String, String> MINECODE_COMPANYNAME_MAP = new LinkedHashMap<>();
        static {
                MINECODE_COMPANYNAME_MAP.put("620824009734", "华亭公司");
                MINECODE_COMPANYNAME_MAP.put("621025009717", "庆阳公司");
                MINECODE_COMPANYNAME_MAP.put("150621011038", "北能公司");
                MINECODE_COMPANYNAME_MAP.put("150781013671", "扎煤公司");
        }

        public static final Map<String, String> MINECODE_NAME_MAP = new LinkedHashMap<>();
        static {
                MINECODE_NAME_MAP.put("620824009734", "砚北煤矿");
                MINECODE_NAME_MAP.put("621025009717", "核桃峪煤矿");
                MINECODE_NAME_MAP.put("150621011038", "高头窑煤矿");
                MINECODE_NAME_MAP.put("150781013671", "灵露煤矿");
        }
}
